home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-04-14 | 7.6 KB | 299 lines | [TEXT/KAHL] |
- $$Loop Windows
- $$Message User Window, u:$Worksheet.name$.cp
-
- $$File u:$Worksheet.name$.cp
- /* $Worksheet.name$ Handle this Window */
- /* $CopyRight$ */
-
- /*
- File name: $Worksheet.name$
- Function: Handle a Window
- History: $Date$ Original by $Author$
-
- */
-
- #include "mmCommon$Prototype.name$.h" /* Common */
- #include "Common$Prototype.name$.h" /* Common */
-
- /* ======================================================= */
- /* ======================================================= */
-
- void CW$Worksheet.name$::Init()
- {
- inherited::Init();
- }
-
-
- $$if Option.EXTRAHOOKS
- /* ======================================================= */
-
- void CW$Worksheet.name$::CloseExtras(Ptr theWS)
- {
- $Worksheet.name$PRec myWS;
-
- inherited::CloseExtras(theWS);
- myWS = ($Worksheet.name$PRec)theWS;
- }
-
- /* ======================================================= */
-
- void CW$Worksheet.name$::UpdateExtras(Ptr theWS)
- {
- $Worksheet.name$PRec myWS;
-
- inherited::UpdateExtras(theWS);
- myWS = ($Worksheet.name$PRec)theWS;
- }
-
- /* ======================================================= */
-
- void CW$Worksheet.name$::OpenExtras(Ptr theWS)
- {
- $Worksheet.name$PRec myWS;
-
- inherited::OpenExtras(theWS);
- myWS = ($Worksheet.name$PRec)theWS;
- }
-
- /* ======================================================= */
-
- void CW$Worksheet.name$::ActivateExtras(Boolean Do_An_Activate,Ptr theWS)
- {
- $Worksheet.name$PRec myWS;
-
- inherited::ActivateExtras(Do_An_Activate,theWS);
- myWS = ($Worksheet.name$PRec)theWS;
-
- if (!Do_An_Activate) /* Handle the deactivate */
- {
- }
- else
- {
- }
- }
-
- /* ======================================================= */
-
- void CW$Worksheet.name$::HandleExtraButtons(Ptr theWS,ControlHandle theControl,short *UnHiliteValue)
- {
- $Worksheet.name$PRec myWS;
- short theSelection;
- long RefCon;
-
-
- inherited::HandleExtraButtons(theWS,theControl,UnHiliteValue);
- myWS = ($Worksheet.name$PRec)theWS;
-
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct button */
- {
- $$Loop Control.type = Button
- case ResC_$Control.name$: /* Button, $Control.FullName$ */
- break;
- $$EndLoop Control.type = Button
- $$Loop Control.type = HotRect
- $$if Control.HotSpot
- case ResC_$Control.name$: /* HotSpot, $Control.FullName$ */
- break;
- $$endif Control.HotSpot
- $$EndLoop Control.type = HotRect
- $$Loop Control.type = Icon
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Icon, $Control.FullName$ */
- break;
- $$endif Control.NonGraphic
- $$EndLoop Control.type = Icon
- $$Loop Control.type = Sicn
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Sicn, $Control.FullName$ */
- break;
- $$endif Control.NonGraphic
- $$EndLoop Control.type = Sicn
- $$Loop Control.type = Picture
- $$if Control.NonGraphic
- case ResC_$Control.name$: /* Picture, $Control.FullName$ */
- break;
- $$endif Control.NonGraphic
- $$EndLoop Control.type = Picture
- $$Loop Control.type = UButton
- case ResC_$Control.name$: /* Plugin Button, $Control.FullName$ */
- break;
- $$EndLoop Control.type = UButton
- $$Loop Control.type = Popup
- case ResC_$Control.name$: /* PopUp, $Control.FullName$ */
- theSelection = GetCtlValue(myWS->Ctrl_$Control.name$); /* Get the Popup selection value */
- switch (theSelection) /* Select correct item */
- {
- $$Loop PopupItems
- case $Control.PopupID$: /* $Control.PopupID$, for $Control.PopupName$ */
- break;
- $$EndLoop PopupItems
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- break;
- $$EndLoop Control.type = Popup
- $$Loop Control.type = Palette
- case ResC_$Control.name$: /* Tool palette, $Control.FullName$ */
- break;
- $$EndLoop Control.type = Palette
-
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- $$if Worksheet.CheckboxesOrRadios
- /* ======================================================= */
-
- void CW$Worksheet.name$::HandleExtraCheckboxes(Ptr theWS,ControlHandle theControl)
- {
- $Worksheet.name$PRec myWS;
- long RefCon; /* RefCon for controls */
-
-
- inherited::HandleExtraCheckboxes(theWS,theControl);
- myWS = ($Worksheet.name$PRec)theWS;
-
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct control */
- {
- $$Loop Control.type = Checkbox
- case ResC_$Control.name$: /* Checkbox, $Control.FullName$ */
- if (myWS->Value_$Control.name$ == 0)
- {
- }
- else
- {
- }
- break;
-
- $$EndLoop Control.type = Checkbox
- $$Loop Control.type = UToggle
- case ResC_$Control.name$: /* Plugin Toggle, $Control.FullName$ */
- if (myWS->Value_$Control.name$ == 0)
- {
- }
- else
- {
- }
- break;
-
- $$EndLoop Control.type = UToggle
- $$Loop Control.type = Radio
- case ResC_$Control.name$: /* Radio, $Control.FullName$ */
- break;
- $$EndLoop Control.type = Radio
-
- default: /* allow other checkboxes and radios, trap for debug */
- break; /* end of otherwise */
- } /* end of case */
- }
-
- $$endif
- $$if Worksheet.Scrollbars
- /* ======================================================= */
-
- /* Routine: HandleScrollBar */
- /* Purpose: Handle a ScrollBar being pressed */
-
- void CW$Worksheet.name$::HandleScrollBar(short code,ControlHandle theControl,Point myPt)
- {
- long RefCon; /* RefCon for controls */
-
-
- inherited::HandleScrollBar(code,theControl,myPt);
- RefCon = GetCRefCon(theControl); /* get control refcon */
-
- switch (RefCon) /* Select correct scrollbar */
- {
- $$Loop Control.type = ScrollBar
- case ResC_$Control.name$: /* Scroll bar, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$Loop Control.type = UGauge
- case ResC_$Control.name$: /* Plugin gauge, $Control.FullName$ */
- break;
-
- $$EndLoop
- $$if Worksheet.Document
- $$if Worksheet.ScrollHorz
- case 12345L: /* Window, scroll horz */
- break;
-
- $$endif
- $$if Worksheet.ScrollVert
- case 12346L: /* Window, scroll vert */
- break;
-
- $$endif
- $$endif Worksheet.Document
- default: /* allow other buttons, trap for debug */
- break; /* end of otherwise */
- } /* end of switch */
- }
-
- $$endif
- /* ======================================================= */
-
- /* Routine: HandleEvent */
- /* Purpose: Handle action to our window, like controls */
-
- void CW$Worksheet.name$::HandleEvent(EventRecord *myEvent)
- {
- short code; /* Location of event in window or controls */
- WindowPtr whichWindow; /* Window pointer where event happened */
- Point myPt; /* Point where event happened */
- ControlHandle theControl; /* Handle for a control */
- $Worksheet.name$PRec theWS;
-
-
- inherited::HandleEvent(myEvent);
- code = FindWindow(myEvent->where,&whichWindow); /* Get where in window and which window */
-
- if (this->RecPtr != nil) /* Only do if the window is us */
- {
- theWS = this->RecPtr;
-
- $$if HasEditLists
- if (myEvent->what == mouseDown)
- {
- myPt = myEvent->where; /* Get mouse position */
- GlobalToLocal(&myPt); /* Make it relative */
-
- $$Loop Control.type = EditText
- if (PtInRect(myPt,&theWS->TERect_$Control.name$)) /* Check for pressed in the TE Edit Text */
- {
- }
-
- $$EndLoop Control.type = EditText
- $$Loop Control.type = List
- if (PtInRect(myPt,&theWS->ListRect_$Control.name$)) /* Check for pressed in list */
- {
- }
-
- $$EndLoop Control.type = List
- }
-
- $$endif HasEditLists
- if ((theWS->theWindow == whichWindow) && (code == inContent)) /* for our window */
- {
- myPt = myEvent->where; /* Get mouse position */
- GlobalToLocal(&myPt); /* Make it relative */
-
- code = FindControl(myPt,whichWindow,&theControl); /* Get type of control */
- }
- }
- }
-
- $$endif Option.EXTRAHOOKS
-
- /* ======================================================= */
- /* ======================================================= */
- $$CloseFile
- $$EndLoop
-